package puziran.party.util;

import java.util.List;
import java.util.Map;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
/**
 * 
 * @author CJX
 * @update 2014-9-4
 */
public class JSONHelper {
	public static Gson g = new GsonBuilder().create();

	/**
	 * Map to JSON
	 * */
	public static String Map2JSON(Map<?, ?> map) {
		return g.toJson(map);
	}
/**
 * JSON to Map
 * */
	public static Map<?, ?> JSON2Map(String json) {
		return g.fromJson(json, Map.class);
	}
	@SuppressWarnings("unchecked")
	public static Map<String,String> JSON2MapStr(String json) {
		return (Map<String,String>)g.fromJson(json, Map.class);
	}
	
	public static List<?> ListJsonToList(String json){
		return g.fromJson(json, List.class);
	}
	 
}
